<div class="actions">
    <?php echo CHtml::link(UserModule::t('View Monthly Attendance'), array('attendance/month'), array('class' => 'btn btn-small btn-success')); ?>
    <?php echo CHtml::link(UserModule::t('View Attendance Report'), array('attendance/report'), array('class' => 'btn btn-small btn-success')); ?>
</div>
<?php $form = $this->beginWidget('CActiveForm'); ?>
<div class="well horizontal">
    <span>Chọn ngày</span>
    <?php echo CHtml::textField('date', null, array()); ?>
    <?php echo CHtml::submitButton('Xem', array('class' => 'btn btn-primary', 'name' => 'view')); ?>
</div>
<table class="table table-striped table-bordered table-condensed">
    <thead>
        <tr>
            <th>#</th>
            <th>Tên nhân viên</th>
            <?php foreach ($workshifts as $workshift): ?>
                <th><?php echo $workshift->title ?></th>
            <?php endforeach; ?>
    </thead>
    <tbody>
        <?php foreach ($rows as $row): ?>
            <tr>
                <td><?php echo $row->user->id ?></td>
                <td>
                    <?php echo CHtml::link($row->user->getName(), array('/user/user/view/id/' . $row->user->id)) ?>
                </td>
                <td><?php
                echo CHtml::dropDownList('Attendance[' . $row->user_id . '][workshift1]', null, array(
                    0 => UserModule::t('Unknown', array(), 'attendance'),
                    1 => UserModule::t('Present', array(), 'attendance'),
                    2 => UserModule::t('Paid Leave', array(), 'attendance'),
                    3 => UserModule::t('Un Paid Leave', array(), 'attendance'),
                        ), array('options' => array($row->selected_one => array('selected' => 'selected'))));
                    ?></td>
                <td><?php
                echo CHtml::dropDownList('Attendance[' . $row->user_id . '][workshift2]', null, array(
                    0 => UserModule::t('Unknown', array(), 'attendance'),
                    1 => UserModule::t('Present', array(), 'attendance'),
                    2 => UserModule::t('Paid Leave', array(), 'attendance'),
                    3 => UserModule::t('Un Paid Leave', array(), 'attendance'),
                        ), array('options' => array($row->selected_two => array('selected' => 'selected'))));
                    ?></td>
                <td><?php
                echo CHtml::dropDownList('Attendance[' . $row->user_id . '][workshift3]', null, array(
                    0 => UserModule::t('Unknown', array(), 'attendance'),
                    1 => UserModule::t('Present', array(), 'attendance'),
                    2 => UserModule::t('Paid Leave', array(), 'attendance'),
                    3 => UserModule::t('Un Paid Leave', array(), 'attendance'),
                        ), array('options' => array($row->selected_three => array('selected' => 'selected'))));
                    ?></td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php echo CHtml::submitButton('Lưu', array('class' => 'btn btn-primary', 'name' => 'save')); ?>
<?php $this->endWidget(); ?>
<script>
    jQuery(document).ready(function($){
        $("#date").datepicker();
        $("#date").datepicker('setDate', '<?php echo $date; ?>');
    });
</script>